This document describes the current state of the Cascading Style Sheet support in Amaya. The implementation is based on the latest (18 Apr 96) CSS1 proposal by Håkon W. Lie and Bert Bos from the W3 Consortium. We focussed on providing as many features as possible and offering an easy to use and learn interface. Considering the second point we choosed a "learn by example" approach suitable for users not experienced with style sheets.
This document contains the following sections:
CSS defines a syntax to describe presentation associated with elements as a set of properties (like colors, fonts, etc.). Associated to properties, a selector restrict the application of these rules to a set of element depending on their type (like H1, or LI), their context (like an EM in a H3) or classes applied to an element. A set of rules defines which properties should be applied when more than one selector match a given element. While this is relatively simple for someone used to handle structured documents, the experience has shown that a new user may have difficulties to modelize a document as a structured entity. This might be a problem when trying to introduce the CSS to a large audience.
Thus, the challenge is to build a tool simple enough so that inexperienced people can use styles when creating HTML pages with Amaya, while retaining all the possibilities of CSS. The interface was also designed to not hide the underlying complexity of the document structure (Structure View) and of the CSS language (CSS rules may be shown), in order to shorten the learning curve to structured presentation design.
One of the strongest features of CSS is the cascading model. Presentation rules can be fetched from different remote files, tied to the document or associated to one specific element in a page. This allows sharing and reuse of sets of rules whilst allowing specific presentation. It allows also the use of an user defined set of rules to accomodate his preferences. We tried to give a complete and simple view of the cascading model, showing separately specific presentation (Structure View), document specific rules (Structure View and CSS dialog box) and all the set of rules associated to the external files referenced by the document. It is possible to manipulate rules in one file but also to move them from one file to another, allowing a user to take presentation rules from a remote server and apply them selectively to his own pages, in the purpose of building a pool of presentation rules.
We first present the Style interface as provided by the current version of Amaya:
The Amaya menu bar contains a Style menu containing all the actions related to presentation and style manipulation. Entries in that menu are ordered from the most specific to the most generic operations, except the two last ones, which are not related to CSS, but to HTML (Information type and Character element).
All modifications made with these dialog boxes can be viewed immediately in the WYSIWYG view and the Structure view.
There are some additionnal dialogs needed for saving CSS files or selecting them from the history.
Here, we focus on what is currently supported from the CSS1 proposal:
There is support for users preferences which can be provided at a site level
in Thot/$PLATFORM/amaya.css
, or specified by the user in
$(HOME)/.amaya.css . Here is an example of an amaya.css
file.
The CSS history is stored in $(HOME)/.amaya/history.css
and
contains the 50 last CSS files loaded by Amaya.
First, considering the current draft compliance, the main issues for full CSS1 support are:
The CSS rules produced by Amaya are re-generated from the internal presentation layer, thus when approximations are made at parsing, the HTML output is degraded.
Considering the user interface, one of the main problems style sheet writers will be faced to is the reverse problem induced by the inheritance complexity:
Beginner's question: How do I produce xxx kind of input ?
CSS Writer's question: Why did it produce xxx kind of input ?
Suppose that a part of a document doesn't have the expected look, why ? Considering the underneath complexity of the cascading order, when referencing multiples external CSS, one can easily understand that debugging CSS in real-use might be difficult. One nice feature would be to show graphically all the rules applying to an element or a zone, where they came from, and which rules they superceded.
Here is a short list of future actions for CSS in Amaya: